<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>TableExport</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <!-- bootstrap table -->
    <link href="css/bootstrap-table.min.css" rel="stylesheet">
</head>
<body>
<div>
    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exportCar">按车型导出Excel</button>
    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exportWorkshop">按车间导出Excel</button>
    <!-- 按车型导出 -->
    <div id="exportCar" class="modal fade bs-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header bg-primary">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title">按车型导出</h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <form class="form-inline">
                            <div class="form-group">
                                <label>日期：</label>
                                <input class="form-control" placeholder="开始日期" id="startDate">
                                <input class="form-control" placeholder="结束日期" id="endDate">
                            </div>
                            <div class="form-group" style="margin-left: 15px">
                                <label>修理点：</label>
                                <select class="form-control">
                                    <option value="拱积路">拱积路</option>
                                    <option value="下盐路">下盐路</option>
                                    <option value="古棕路">古棕路</option>
                                    <option value="芦潮港">芦潮港</option>
                                </select>
                            </div>
                            <div class="form-group" style="margin-left: 10px">
                                <button class="btn btn-primary">查询</button>
                            </div>
                        </form>
                    </div>
                    <div class="row">
                        <table id="byCar" data-striped="true">
                            <thead>
                            <tr>
                                <th data-field="id">序号</th>
                                <th data-field="name">车型</th>
                                <th data-field="price">车辆数(辆)</th>
                                <th data-field="name">小修数(次)</th>
                                <th data-field="price">高峰时段维修数(次)</th>
                                <th data-field="id">路救数(次)</th>
                                <th data-field="id">修理频率(辆)</th>
                                <th data-field="id">留厂车(辆)</th>
                                <th data-field="id">保养执行率(%)</th>
                                <th data-field="id">车间修理费用(元)</th>
                                <th data-field="id">重大费用领取(元)</th>
                                <th data-field="id">玻璃类费用(元)</th>
                            </tr>
                            </thead>
                            <tbody>

                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                </div>
            </div>
        </div>
    </div>
    <!-- 按车型导出 -->
    <div id="exportWorkshop" class="modal fade bs-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header bg-primary">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title">按车间导出数据</h4>
                </div>
                <div class="modal-body">
                    <table id="byWorkshop" data-striped="true">
                        <thead>
                        <tr>
                            <th data-field="id">序号</th>
                            <th data-field="name">修理车间</th>
                            <th data-field="price">车辆数(辆)</th>
                            <th data-field="name">小修数(次)</th>
                            <th data-field="price">高峰时段维修数(次)</th>
                            <th data-field="id">路救数(次)</th>
                            <th data-field="id">修理频率(辆)</th>
                            <th data-field="id">留厂车(辆)</th>
                            <th data-field="id">保养执行率(%)</th>
                            <th data-field="id">车间修理费用(元)</th>
                            <th data-field="id">重大费用领取(元)</th>
                            <th data-field="id">玻璃类费用(元)</th>
                        </tr>
                        </thead>
                        <tbody>

                        </tbody>
                    </table>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery-3.2.1.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- bootstrap table -->
<script src="js/bootstrap-table.min.js"></script>
<script src="js/bootstrap-table-zh-CN.min.js"></script>
<script src="js/bootstrap-table-export.min.js"></script>
<script src="js/xlsx.core.min.js"></script>
<script src="js/tableExport.min.js"></script>
<script>
    $(function () {
       $("#byCar").bootstrapTable({
           url: 'data1.json',
           cache: false,
           pagination: true,                   //是否显示分页（*）
           pageSize: 10,
           pageList: [10, 15],
           showExport:true,
           exportDataType:'all',
           exportTypes:['xlsx'],
           exportOptions:{
               fileName:'车型'
           }
       });
        $("#byWorkshop").bootstrapTable({
            url: 'data1.json',
            cache: false,
            pagination: true,                   //是否显示分页（*）
            pageSize: 10,
            pageList: [10, 15],
            showExport:true,
            exportDataType:'all',
            exportTypes:['xlsx'],
            exportOptions:{
                fileName:'车间'
            }
        });
    });
</script>
</body>
</html>